package com.gzhryc.shared_device.oem.h5.agent.controllers.api.v1.member;

import com.gzhryc.common.StringTools;
import com.gzhryc.common.api.DefaultAPIResponse;
import com.gzhryc.common.logging.Logger;
import com.gzhryc.servlet.WebUtils;
import com.gzhryc.servlet.annotation.Route;
import com.gzhryc.shared_device.oem.h5.agent.ClientAPICodeConstants;
import com.gzhryc.shared_device.oem.h5.agent.LoginUser;
import com.gzhryc.shared_device.oem.h5.agent.WebConstants;
import com.gzhryc.shared_device.oem.h5.agent.dto.api.v1.member.*;

import javax.servlet.http.HttpServletRequest;

/**
 * 洗车券核销
 * @version 2023-11-10
 */
public class MemberVerificationVoucherController {

    static Logger log = Logger.getLogger(MemberVerificationVoucherController.class);

    @Route(value = "/agent/api/v1/member/verification_voucher/list.data")
    public MemberVerificationVoucherListResponse list(HttpServletRequest request) {
        MemberVerificationVoucherListResponse apiResp = new MemberVerificationVoucherListResponse(ClientAPICodeConstants.NULL_DATA, "暂无数据");
        MemberVerificationVoucherListRequest apiReq = WebUtils.getJsonRequest(request, MemberVerificationVoucherListRequest.class);
        if (apiReq != null && apiReq.getBody().getType() != null) {
            LoginUser loginUser = WebUtils.getAttribute(request, WebConstants.ATTR_LOGIN_USER, LoginUser.class);
            if (loginUser != null) {
                
            }
        }
        return apiResp;
    }

    @Route(value = "/agent/api/v1/member/verification_voucher/info.data")
    public MemberVerificationVoucherInfoResponse info(HttpServletRequest request) {
        MemberVerificationVoucherInfoResponse apiResp = new MemberVerificationVoucherInfoResponse(ClientAPICodeConstants.NULL_DATA, "暂无数据");
        MemberVerificationVoucherInfoRequest apiReq = WebUtils.getJsonRequest(request, MemberVerificationVoucherInfoRequest.class);
        if (apiReq != null && apiReq.getBody().getType() != null && StringTools.isNotBlank(apiReq.getBody().getId())) {
            LoginUser loginUser = WebUtils.getAttribute(request, WebConstants.ATTR_LOGIN_USER, LoginUser.class);
            if (loginUser != null) {
                
            }
        }
        return apiResp;
    }

    @Route(value = "/agent/api/v1/member/verification_voucher/use.do")
    public DefaultAPIResponse doUse(HttpServletRequest request) {
        DefaultAPIResponse apiResp = new DefaultAPIResponse(ClientAPICodeConstants.EXECUTE_ERROR, "核销失败，请联系客服");
        MemberVerificationVoucherUseRequest apiReq = WebUtils.getJsonRequest(request, MemberVerificationVoucherUseRequest.class);
        if (apiReq != null && apiReq.getBody().getType() != null && StringTools.isNotBlank(apiReq.getBody().getId())) {
            LoginUser loginUser = WebUtils.getAttribute(request, WebConstants.ATTR_LOGIN_USER, LoginUser.class);
            if (loginUser != null) {
                
            }
        }
        return apiResp;
    }

    @Route(value = "/agent/api/v1/order/verification_voucher/set.do")
    public DefaultAPIResponse doSet(HttpServletRequest request){
        DefaultAPIResponse apiResp = new DefaultAPIResponse(ClientAPICodeConstants.EXECUTE_ERROR, "发放失败，请联系客服");
        OrderVerificationVoucherSetRequest apiReq = WebUtils.getJsonRequest(request, OrderVerificationVoucherSetRequest.class);
        if (apiReq != null && apiReq.getBody().getType() != null && StringTools.isNotBlank(apiReq.getBody().getTradeNo())) {
            LoginUser loginUser = WebUtils.getAttribute(request, WebConstants.ATTR_LOGIN_USER, LoginUser.class);
            if (loginUser != null) {
                
            }
        }
        return apiResp;
    }
}
